package com.spring.demo5.eg2;

import com.spring.demo5.eg1.FundService;
import org.junit.Test;
import org.springframework.aop.framework.ProxyFactory;

/**
 * @author vhans
 */
public class AopTest {
    @Test
    public void test() {
        ProxyFactory proxyFactory = new ProxyFactory(new FundService());
        // 添加一个异常通知
        proxyFactory.addAdvice(new SendMsgThrowsAdvice());
        FundService proxy = (FundService) proxyFactory.getProxy();
        // 超额取款
        proxy.cashOut("Vhans", 8888);
    }
}
